package com.zyicoding.myfactory.service.impl;

import com.zyicoding.myfactory.dao.ProductionlineMapper;
import com.zyicoding.myfactory.pojo.Productionline;
import com.zyicoding.myfactory.service.ProductionLineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class ProductionLineServiceImpl implements ProductionLineService {
    @Autowired
    private ProductionlineMapper productionlineMapper;

    @Override
    public List<Productionline> selectAllProductionLine() {

        return productionlineMapper.selectList(null);
    }

    @Override
    public Productionline selectLineById(Integer id) {
        return productionlineMapper.selectById(id);
    }

    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public Boolean changeLineStatus(Productionline productionline) {

        return productionlineMapper.updateById(productionline) > 0;
    }

}
